/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/KeyExchange/dhCalcNewPublicKeyRequest.h,v 1.4 2003/11/21 12:39:24 itsme Exp $
 *
 *
 */


#ifndef __DHCALCNEWPUBLICKEYREQUEST_H__

#include <windows.h>

#include "dhCalcRequest.h"
#include "bignum.h"

/* 
 *  this message is sent to the calc thread, 
 *  after the other side public value is received 
 */
class CalcNewPublicKeyRequest : public CalcRequest {
public:
    CalcNewPublicKeyRequest(
        const Number& subgroupgenerator, const Number& modulusprime, const Number& subgroupprime,
        Number& secretval, Number& publicval, HANDLE hSuccessEvent, HANDLE hFailEvent)
        : m_subgroup_generator(subgroupgenerator), m_modulus_prime(modulusprime), m_subgroup_prime(subgroupprime),
          m_secret(secretval), m_public(publicval), CalcRequest(hSuccessEvent, hFailEvent)
    {
    }

    virtual bool doCalculation();

    bool GenerateSecret(Number& secret);

public:
    const Number& m_subgroup_generator;
    const Number& m_modulus_prime;
    const Number& m_subgroup_prime;

    Number& m_secret;
    Number& m_public;
};


#define __DHCALCNEWPUBLICKEYREQUEST_H__
#endif
